<script>
	import {mapState,mapMutations} from 'vuex'
	import Ws from '@/utils/socket.js'
	export default {
		onLaunch: function() {
			if(this.userId && this.webSocket){
				console.log('11111',this.setWebSocket())
				this.setWebSocket(new Ws('wss://jinchengzi.cn/wss', 3000,this.userId))
			}
			if(!this.userInfo.token){
				uni.reLaunch({
					url: '/pages/index/index'
				})
			}
		},
		onShow: function() {
			  
		},
		onHide: function() {
			 
		},
		methods: {
			...mapMutations('user', ['setWebSocket'])
		},
		computed: {
			...mapState('user', ['userId','userInfo','webSocket','token'])
		}
	}
</script> 
<style lang="scss">
	@import "./static/font/iconfont.css";
	/*每个页面公共css */
	@import "@/uni_modules/uview-ui/index.scss";
	// #ifdef H5
		/* body{
			width: 2000rpx;
			margin: auto;
		} */
	// #endif
</style>